/* This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the Do What The Fuck You Want
 * To Public License, Version 2, as published by Sam Hocevar. See
 * http://sam.zoy.org/wtfpl/COPYING for more details. */ 
package de.rockon.fuzzy.controller.gui.tree.treehelper;

import java.awt.Component;

import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellEditor;
import javax.swing.tree.DefaultTreeCellRenderer;

import de.rockon.fuzzy.controller.model.FuzzyController;

public class TreeEditor extends DefaultTreeCellEditor {
	public TreeEditor(JTree tree, DefaultTreeCellRenderer renderer) {
		super(tree, renderer);
	}

	@Override
	public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) {

		if (value instanceof FuzzyController) {
			System.out.println("TODO: FuzzyTreeEditor.getTreeCellEditorComponent() wieder reparieren");
			// DialogFuzzyVariable powerDialog = new DialogFuzzyVariable(null, false, (FuzzyController)value);
			// if (powerDialog.isValid()) {
			// FuzzyController val = (FuzzyController) value;
			// val.setName(powerDialog.getFuzzyName());
			// // val.set
			// System.out.println("++++: "+powerDialog.getFuzzyName());
			// System.out.println("++++: "+powerDialog.getUnit());
			// System.out.println("++++: "+powerDialog.getInputOutputType());
			//
			// System.out.println("Valide");
			// }
			//			

		}

		return super.getTreeCellEditorComponent(tree, value, isSelected, expanded, leaf, row);
	}

}
